﻿@using Coralcode.Adapter.Gather.Entity.Enums
@using CoralNode.MvcClient.Helper

@{
    ViewBag.Title = "采集内容";
}
@Html.IncludePage("CoralAdmin/gather", "_Left")
<!--content-->
<div id="pbody">
    <div class="extra">
        <div class="pbody_top">
            <span class="ico ico_import"></span><span class="t t_c">采集管理 /<b class="t_small f_no">采集内容</b></span>
        </div>
        <div id="main">
            <div class="">
                <div class="tablelist_style1" data-js="tabellist_style1">
                    <table cellpadding="0" cellspacing="0">
                        <thead>
                            <tr class="t_bg">
                                <th width="60">选择</th>
                                @foreach (var property in ViewBag.Properties)
                                {
                                    <th style="max-width: 300px;">@property</th>
                                }
                                <th width="17%">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (var propertyValue in ViewBag.PropertyValues)
                            {
                                <tr>
                                    <td>
                                        <label class="checkbox_own">
                                            <input name="checkboxid" type="checkbox" value="@propertyValue.Key.Id" /></label>
                                    </td>
                                    @foreach (var value in propertyValue.Value)
                                    {
                                        <td>@value</td>
                                    }
                                    <td>
                                        @Html.ActionLink("导入数据库","transformation",new{gatherId=Request["gatherId"],id=propertyValue.Key.Id})
                                    </td>
                                </tr>
                            }
                        </tbody>
                    </table>
                    <div class="global_fun ">
                        <label class="checkbox_own gloabal_select">
                            <input type="checkbox" /></label>
                        <input type="button" class="btn_4 btn invert" value="反选" /><input type="button" class="btn_4 btn reset"
                                                                                          value="重置" /><input type="button" class="btn_4 btn import" value="导入数据库" />
                    </div>
                </div>
            </div>
        </div>
        @Html.IncludePage("CoralAdmin/Shared","Pager")
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $(".import").click(function () {
            if ($("[name='checkboxid']:checked").length == 0) {
                alert("没有选中待导入数据!");
                return;
            }
            var ids = new Array();
            $("[name='checkboxid']:checked").each(function () {
                ids.push($(this).val());
            });
            window.location = "@Url.Action("transformationmulti", new {gatherid = Request["gatherId"]})&ids=" + ids.join();
        });
    });
</script>